/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lucene.Analyzers;

import java.io.Reader;
import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseTokenizer;
import org.apache.lucene.analysis.PorterStemFilter;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream;

public class StemmingPositionStopAnalyzer extends Analyzer {
    private Set stopWords;
    
    public StemmingPositionStopAnalyzer() {
        this(StopAnalyzer.ENGLISH_STOP_WORDS);
    }
    
    public StemmingPositionStopAnalyzer(String[] stopList) {
        stopWords = StopFilter.makeStopSet(stopList);       
    }   
        
/*Do livro: "I", "about", "also", , "any", , "aren", "arent",
"around",,  "because", "been", "before", "being",
"between", "both",   "can", "cannot", "cant", "come",
"could", "day", "did", "do", "doe", "does", "doesn", "doesnt",
"dont","either", "even", "every",  "from", "get",
"great", "had", "has", "hasn", "hasnt", "have", "havn",
"havnt", "he", "help", "her", "here", "him", "his", "how",
 "info", , "is", , "its", "just", "let", "life",
"live", "many", "may", "me", "most", "much", "must", "my",
"need", , ,  "one", "only",  "other", "our",
"please", "question", "re", "really", "regard", "said", "say",
"see", "she", "should", "since", "so", "some", "still", "story",
 "take", "than", "thank", ,   "them",
"thing", "those", "thought",
"through", "thru", "thus",  "told", "too", "use", "used",
"uses", "using", "ve", "very", "want",  "way", "we",
"well", "were", "what", "when", "where", "which", "who", "why",
 "without", "won", "wont", "would", "you", "your"
};*/

    
    public TokenStream tokenStream(String fieldName, Reader reader) {
        return new PorterStemFilter( 
                new PositionStopFilter(new LowerCaseTokenizer(reader),stopWords));
    }

}
